package cn.edu.bjtu.toychange.entity;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the toy database table.
 * 
 */
@Entity
//@NamedQuery(name="Toy.findAll", query="SELECT t FROM Toy t")
public class Toy implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int t_toyID;

	private String t_description;

	private int t_highAge;

	private double t_intialPrice;

	private int t_lowAge;

	private double t_newoldDegree;

	@Temporal(TemporalType.DATE)
	private Date t_onShelfTime;

	private int t_state;

	private String t_toyName;

	private String t_type;

	//bi-directional many-to-one association to Requisition
	@OneToMany(mappedBy="toy1")
	private List<Requisition> requisitions1;

	//bi-directional many-to-one association to Requisition
	@OneToMany(mappedBy="toy2")
	private List<Requisition> requisitions2;

	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="T_userID")
	private User user;

	//bi-directional many-to-one association to Transrecord
	@OneToMany(mappedBy="toy1")
	private List<TransRecord> transrecords1;

	//bi-directional many-to-one association to Transrecord
	@OneToMany(mappedBy="toy2")
	private List<TransRecord> transrecords2;

	public Toy() {
	}

	public int getT_toyID() {
		return this.t_toyID;
	}

	public void setT_toyID(int t_toyID) {
		this.t_toyID = t_toyID;
	}

	public String getT_description() {
		return this.t_description;
	}

	public void setT_description(String t_description) {
		this.t_description = t_description;
	}

	public int getT_highAge() {
		return this.t_highAge;
	}

	public void setT_highAge(int t_highAge) {
		this.t_highAge = t_highAge;
	}

	public double getT_intialPrice() {
		return this.t_intialPrice;
	}

	public void setT_intialPrice(double t_intialPrice) {
		this.t_intialPrice = t_intialPrice;
	}

	public int getT_lowAge() {
		return this.t_lowAge;
	}

	public void setT_lowAge(int t_lowAge) {
		this.t_lowAge = t_lowAge;
	}

	public double getT_newoldDegree() {
		return this.t_newoldDegree;
	}

	public void setT_newoldDegree(double t_newoldDegree) {
		this.t_newoldDegree = t_newoldDegree;
	}

	public Date getT_onShelfTime() {
		return this.t_onShelfTime;
	}

	public void setT_onShelfTime(Date t_onShelfTime) {
		this.t_onShelfTime = t_onShelfTime;
	}

	public int getT_state() {
		return this.t_state;
	}

	public void setT_state(int t_state) {
		this.t_state = t_state;
	}

	public String getT_toyName() {
		return this.t_toyName;
	}

	public void setT_toyName(String t_toyName) {
		this.t_toyName = t_toyName;
	}

	public String getT_type() {
		return this.t_type;
	}

	public void setT_type(String t_type) {
		this.t_type = t_type;
	}

	public List<Requisition> getRequisitions1() {
		return this.requisitions1;
	}

	public void setRequisitions1(List<Requisition> requisitions1) {
		this.requisitions1 = requisitions1;
	}

	public Requisition addRequisitions1(Requisition requisitions1) {
		getRequisitions1().add(requisitions1);
		requisitions1.setToy1(this);

		return requisitions1;
	}

	public Requisition removeRequisitions1(Requisition requisitions1) {
		getRequisitions1().remove(requisitions1);
		requisitions1.setToy1(null);

		return requisitions1;
	}

	public List<Requisition> getRequisitions2() {
		return this.requisitions2;
	}

	public void setRequisitions2(List<Requisition> requisitions2) {
		this.requisitions2 = requisitions2;
	}

	public Requisition addRequisitions2(Requisition requisitions2) {
		getRequisitions2().add(requisitions2);
		requisitions2.setToy2(this);

		return requisitions2;
	}

	public Requisition removeRequisitions2(Requisition requisitions2) {
		getRequisitions2().remove(requisitions2);
		requisitions2.setToy2(null);

		return requisitions2;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public List<TransRecord> getTransrecords1() {
		return this.transrecords1;
	}

	public void setTransrecords1(List<TransRecord> transrecords1) {
		this.transrecords1 = transrecords1;
	}

	public TransRecord addTransrecords1(TransRecord transrecords1) {
		getTransrecords1().add(transrecords1);
		transrecords1.setToy1(this);

		return transrecords1;
	}

	public TransRecord removeTransrecords1(TransRecord transrecords1) {
		getTransrecords1().remove(transrecords1);
		transrecords1.setToy1(null);

		return transrecords1;
	}

	public List<TransRecord> getTransrecords2() {
		return this.transrecords2;
	}

	public void setTransrecords2(List<TransRecord> transrecords2) {
		this.transrecords2 = transrecords2;
	}

	public TransRecord addTransrecords2(TransRecord transrecords2) {
		getTransrecords2().add(transrecords2);
		transrecords2.setToy2(this);

		return transrecords2;
	}

	public TransRecord removeTransrecords2(TransRecord transrecords2) {
		getTransrecords2().remove(transrecords2);
		transrecords2.setToy2(null);

		return transrecords2;
	}

}